home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / misc~1 / 199 / lib / vdi.c < prev   
Encoding:
C/C++ Source or Header  |  1988-03-14  |  22.2 KB  |  1,367 lines

  1. /*
  2.  * The VDI library for GEM calls
  3.  *
  4.  */
  5.  
  6. extern int    ct0, ct1, ct2, ct3, ct4, ct5, ct6, ct7, ct8, ct9, ct10, ct11;
  7. extern int    ii0, ii1, ii2, ii3, ii4, ii5, ii6, ii7, ii8, ii9,
  8.         ii10, ii11, ii12, ii13, ii14, ii15;
  9. extern int    io0, io1, io2, io3, io4, io5, io6, iox[40];
  10. extern int    pi0, pi1, pi2, pi3, pi4, pi5, pi6, pi7, pix[6];
  11. extern int    po0, po1, po2, po3, pox[12];
  12. extern int     *ai0, *ai1;
  13. extern int    *ao0;
  14. extern int    *vdi0, *vdi1, *vdi2, *vdi3, *vdi4, *vdi5;
  15. extern int    global[16];
  16.  
  17.  
  18. /* VDI routines for the GEM library */
  19.  
  20.  
  21. /* 
  22.  * GEM:VDI open virtual workstation 
  23.  *     "in" should point to work_in[11]
  24.  *     "out" should point to work_out[57];
  25.  *     "handle" is both input and output
  26.  */
  27.  
  28. v_opnwk(in, handle, out) int *in, *handle, *out; {
  29.     int i, j, *intin, *intout, *ptsout;
  30.     ct0 = 1;
  31.     ct1 = 0;
  32.     ct3 = 11;
  33.     ct6 = *handle;
  34.     intin = &ii0;
  35.     for (i = 0; i < 11; i++) intin[i] = in[i];
  36.     vdi();
  37.     intout = &io0;
  38.     for (i = 0; i < 45; i++) out[i] = intout[i];
  39.     ptsout = &po0;
  40.     for (j = 0; j < 12; j++) out[i++] = ptsout[j];
  41.     *handle = ct6;
  42. }
  43.  
  44.  
  45. v_opnvwk(in, handle, out) int *in, *handle, *out; {
  46.     int i, j, *intin, *intout, *ptsout;
  47.     ct0 = 100;
  48.     ct1 = 0;
  49.     ct3 = 11;
  50.     ct6 = *handle;
  51.     intin = &ii0;
  52.     for (i = 0; i < 11; i++) intin[i] = in[i];
  53.     vdi();
  54.     intout = &io0;
  55.     for (i = 0; i < 45; i++) out[i] = intout[i];
  56.     ptsout = &po0;
  57.     for (j = 0; j < 12; j++) out[i++] = ptsout[j];
  58.     *handle = ct6;
  59. }
  60.  
  61. vq_extnd(handle, owflag, out) int *out; {
  62.     int i, j, *intout, *ptsout;
  63.     ct0 = 102;
  64.     ct1 = 0;
  65.     ct3 = 1;
  66.     ct6 = handle;
  67.     ii0 = owflag;
  68.     vdi();
  69.     intout = &io0;
  70.     for (i = 0; i < 45; i++) out[i] = intout[i];
  71.     ptsout = &po0;
  72.     for (j = 0; j < 12; j++) out[i++] = ptsout[j];
  73. }
  74.  
  75. /* GEM:VDI close the workstation */
  76.  
  77. v_clswk(handle) {
  78.     ct0 = 2;
  79.     ct6 = handle;
  80.     ct1 = ct3 = 0;
  81.     vdi();
  82. }
  83.  
  84. v_clsvwk(handle) {
  85.     ct0 = 101;
  86.     ct6 = handle;
  87.     ct1 = ct3 = 0;
  88.     vdi();
  89. }
  90.  
  91. /* GEM:VDI clear the workstation */
  92.  
  93. v_clrwk(handle) {
  94.     ct0 = 3;
  95.     ct1 = 0;
  96.     ct3 = 0;
  97.     ct6 = handle;
  98.     vdi();
  99. }
  100.  
  101. v_updwk(handle) {
  102.     ct0 = 4;
  103.     ct1 = ct3 = 0;
  104.     ct6 = handle;
  105.     vdi();
  106. }
  107.  
  108. vst_load_fonts(handle,select) {
  109.     ct0 = 119;
  110.     ct1 = 0;
  111.     ct3 = 1;
  112.     ct6 = handle;
  113.     ii0 = select;
  114.     vdi();
  115.     return io0;
  116. }
  117.  
  118. vst_unload_fonts(handle,select) {
  119.     ct0 = 120;
  120.     ct1 = 0;
  121.     ct3 = 1;
  122.     ct6 = handle;
  123.     io0 = select;
  124.     vdi();
  125. }
  126.     
  127. /* GEM:VDI poly line output */
  128.  
  129. v_pline(handle, count, pxy) int *pxy; {
  130.     ct0 = 6;
  131.     ct1 = count;
  132.     ct3 = 0;
  133.     ct6 = handle;
  134.     vdi2 = pxy;
  135.     vdi();
  136.     vdi2 = &po0;
  137. }
  138.  
  139. /* GEM:VDI put text on the screen */
  140.  
  141. v_gtext(handle, x, y, string) char *string; {
  142.     int n, *intin;
  143.     ct0 = 8;
  144.     ct1 = 1;
  145.     intin = &ii0;
  146.     for (n = 0; string[n]; n++)
  147.         intin[n] = string[n];
  148.     ct3 = n;
  149.     ct6 = handle;
  150.     pi0 = x;
  151.     pi0 = y;
  152.     vdi();
  153. }
  154.  
  155. /* 
  156.  * GEM:VDI set clipping rectangle 
  157.  *    flag = 0     no clipping
  158.  *    flag = 1    clipping on
  159.  *     pxy[] should contain the upper left and bottom right coords
  160.  */
  161.  
  162. vs_clip(handle, flag, pxy) int *pxy; {
  163.     ct0 = 129;
  164.     ct1 = 2;
  165.     ct3 = 1;
  166.     ct6 = handle;
  167.     ii0 = flag;
  168.     vdi2 = pxy;
  169.     vdi();
  170.     vdi2 = &pi0;
  171. }
  172.  
  173. /* GEM:VDI polymarker output */
  174.  
  175. v_pmarker(handle, count, pxy) int *pxy; {
  176.     ct0 = 7;
  177.     ct1 = count;
  178.     ct3 = 0;
  179.     ct6 = handle;
  180.     vdi2 = pxy;
  181.     vdi();
  182.     vdi2 = &pi0;
  183. }
  184.  
  185. /* GEM:VDI fill area */
  186.  
  187. v_fillarea(handle, count, pxy) int *pxy; {
  188.     ct0 = 9;
  189.     ct1 = count;
  190.     ct3 = 0;
  191.     ct6 = handle;
  192.     vdi2 = pxy;
  193.     vdi();
  194.     vdi2 = &pi0;
  195. }
  196.  
  197. /* GEM:VDI cell array */
  198.  
  199. v_cellarray(handle,pxy,row_length,el_used,num_rows,wrt_mode,colarray)
  200.     int *pxy, *colarray; {
  201.     ct0 = 10;
  202.     ct1 = 2;
  203.     ct3 = num_rows * el_used;
  204.     ct6 = handle;
  205.     ct7 = row_length;
  206.     ct8 = el_used;
  207.     ct9 = num_rows;
  208.     ct10 = wrt_mode;
  209.     vdi1 = colarray;
  210.     vdi2 = pxy;
  211.     vdi();
  212.     vdi1 = &ii0;
  213.     vdi2 = &pi0;
  214. }
  215.     
  216. /* GEM:VDI contour fill */
  217.  
  218. v_contourfill(handle, x, y, index) {
  219.     ct0 = 103;
  220.     ct1 = 1;
  221.     ct3 = 1;
  222.     ct6 = handle;
  223.     ii0 = index;
  224.     pi0 = x;
  225.     pi1 = y;
  226.     vdi();
  227. }
  228.  
  229. /* GEM:VDI rectangle fill */
  230.  
  231. vr_recfl(handle, pxy) int *pxy; {
  232.     ct0 = 114;
  233.     ct1 = 2;
  234.     ct3 = 0;
  235.     ct6 = handle;
  236.     vdi2 = pxy;
  237.     vdi();
  238.     vdi2 = &pi0;
  239. }
  240.  
  241. /* GEM:VDI bar graph */
  242.  
  243. v_bar(handle, pxy) int *pxy; {
  244.     ct0 = 11;
  245.     ct1 = 2;
  246.     ct3 = 0;
  247.     ct5 = 1;
  248.     ct6 = handle;
  249.     vdi2 = pxy;
  250.     vdi();
  251.     vdi2 = &pi0;
  252. }
  253.  
  254. /* GEM:VDI arc */
  255.  
  256. v_arc(handle, x, y, rad, b_angle, e_angle) {
  257.     int i, *ptsin;
  258.     ct0 = 11;
  259.     ct1 = 4;
  260.     ct3 = 2;
  261.     ct5 = 2;
  262.     ct6 = handle;
  263.     ii0 = b_angle;
  264.     ii1 = e_angle;
  265.     pi0 = x;
  266.     pi1 = y;
  267.     pi6 = rad;
  268.     pi2 = pi3 = pi4 = pi5 = pi7 = 0;
  269.     vdi();
  270. }
  271.  
  272. /* GEM:VDI pie */
  273.  
  274. v_pieslice(handle, x, y, rad, b_angle, e_angle) {
  275.     int i;
  276.     ct0 = 11;
  277.     ct1 = 4;
  278.     ct3 = 2;
  279.     ct5 = 3;
  280.     ct6 = handle;
  281.     ii0 = b_angle;
  282.     ii1 = e_angle;
  283.     pi0 = x;
  284.     pi1 = y;
  285.     pi6 = rad;
  286.     pi2 = pi3 = pi4 = pi5 = pi7 = 0;
  287.     vdi();
  288. }
  289.  
  290. /* GEM:VDI circle */
  291.  
  292. v_circle(handle, x, y, rad) {
  293.     int i;
  294.     ct0 = 11;
  295.     ct1 = 3;
  296.     ct3 = 0;
  297.     ct5 = 4;
  298.     ct6 = handle;
  299.     pi0 = x;
  300.     pi1 = y;
  301.     pi4 = rad;
  302.     pi2 = pi3 = pi5 = 0;
  303.     vdi();
  304. }
  305.  
  306. /* GEM:VDI elliptical arc */
  307.  
  308. v_ellarc(handle, x, y, xrad, yrad, b_angle, e_angle) {
  309.     int i;
  310.     ct0 = 11;
  311.     ct1 = 2;
  312.     ct3 = 2;
  313.     ct5 = 6;
  314.     ct6 = handle;
  315.     ii0 = b_angle;
  316.     ii1 = e_angle;
  317.     pi0 = x;
  318.     pi1 = y;
  319.     pi2 = xrad;
  320.     pi3 = yrad;
  321.     vdi();
  322. }
  323.  
  324. /* GEM:VDI elliptical pie */
  325.  
  326. v_ellpie(handle, x, y, xrad, yrad, b_angle, e_angle) {
  327.     int i;
  328.     ct0 = 11;
  329.     ct1 = 2;
  330.     ct3 = 2;
  331.     ct5 = 7;
  332.     ct6 = handle;
  333.     ii0 = b_angle;
  334.     ii1 = e_angle;
  335.     pi0 = x;
  336.     pi1 = y;
  337.     pi2 = xrad;
  338.     pi3 = yrad;
  339.     vdi();
  340. }
  341.  
  342. /* GEM:VDI ellipse */
  343.  
  344. v_ellipse(handle, x, y, xrad, yrad) {
  345.     ct0 = 11;
  346.     ct1 = 2;
  347.     ct3 = 0;
  348.     ct5 = 5;
  349.     ct6 = handle;
  350.     pi0 = x;
  351.     pi1 = y;
  352.     pi2 = xrad;
  353.     pi3 = yrad;
  354.     vdi();
  355. }
  356.  
  357. /* GEM:VDI rounded box */
  358.  
  359. v_rbox(handle, pxy) int *pxy; {
  360.     ct0 = 11;
  361.     ct1 = 2;
  362.     ct3 = 0;
  363.     ct5 = 8;
  364.     ct6 = handle;
  365.     vdi2 = pxy;
  366.     vdi();
  367.     vdi2 = &pi0;
  368. }
  369.  
  370. /* GEM:VDI rounded filled box */
  371.  
  372. v_rfbox(handle, pxy) int *pxy; {
  373.     ct0 = 11;
  374.     ct1 = 2;
  375.     ct3 = 0;
  376.     ct5 = 9;
  377.     ct6 = handle;
  378.     vdi2 = pxy;
  379.     vdi();
  380.     vdi2 = &pi0;
  381. }
  382.  
  383. /* GEM:VDI put justified text on the screen */
  384.  
  385. v_justified(handle, x, y, string, len, wspace, cspace) char *string; {
  386.     int *ip;
  387.     ct0 = 11;
  388.     ct1 = 2;
  389.     ct6 = handle;
  390.     ii0 = wspace;
  391.     ii1 = cspace;
  392.     ip = &ii2;
  393.     for (ct3 = 2; *ip++ = *string++; ct3++)
  394.         ;
  395.     pi0 = x;
  396.     pi1 = y;
  397.     pi2 = len;
  398.     vdi();
  399. }
  400.  
  401. /* GEM:VDI set drawing mode */
  402.  
  403. vswr_mode(handle, mode) { return vset(handle, 32, mode); }
  404.  
  405. /* GEM:VDI set color */
  406.  
  407. vs_color(handle, index, rgb) int *rgb; {
  408.     ct0 = 14;
  409.     ct1 = 0;
  410.     ct3 = 4;
  411.     ct6 = handle;
  412.     ii0 = index;
  413.     ii1 = rgb[0];
  414.     ii2 = rgb[1];
  415.     ii3 = rgb[2];
  416.     vdi();
  417. }
  418.  
  419. /* GEM:VDI set line color */
  420.  
  421. vsl_color(handle, color) { return vset(handle, 17, color); }
  422.  
  423. /* GEM:VDI set line type */
  424.  
  425. vsl_type(handle, type) { return vset(handle, 15, type); }
  426.  
  427. /* GEM:VDI set marker type */
  428.  
  429. vsm_type(handle, type) { return vset(handle, 18, type); }
  430.  
  431. /* GEM:VDI set marker height */
  432.  
  433. vsm_height(handle, height) {
  434.     ct0 = 19;
  435.     ct1 = 1;
  436.     ct3 = 0;
  437.     ct6 = handle;
  438.     pi0 = 0;
  439.     pi1 = height;
  440.     vdi();
  441.     return po1;
  442. }
  443.  
  444. /* GEM:VDI set user defined line type */
  445.  
  446. vsl_udsty(handle, pattern) { return vset(handle, 113, pattern); }
  447.  
  448. /* GEM:VDI set the width of a line */
  449.  
  450. vsl_width(handle, width) { 
  451.     ct0 = 16;
  452.     ct1 = 1;
  453.     ct3 = 0;
  454.     ct6 = handle;
  455.     pi0 = width;
  456.     pi1 = 0;
  457.     vdi();
  458.     return po0;
  459. }
  460.  
  461. /* GEM:VDI line end style  */
  462.  
  463. vsl_ends(handle, begin, end) {
  464.     ct0 = 108;
  465.     ct1 = 0;
  466.     ct2 = 2;
  467.     ct6 = handle;
  468.     ii0 = begin;
  469.     ii1 = end;
  470.     vdi();
  471. }
  472.  
  473. /* GEM:VDI set marker color */
  474.  
  475. vsm_color(handle, color) { return vset(handle, 20, color); }
  476.  
  477. /* GEM:VDI set text height, returns char size and cell(box) size  */
  478.  
  479. vst_height(handle, h, cw, ch, bw, bh) int *cw, *ch, *bw, *bh; {
  480.     ct0 = 12;
  481.     ct1 = 1;
  482.     ct3 = 0;
  483.     ct6 = handle;
  484.     pi0 = 0;
  485.     pi1 = h;
  486.     vdi();
  487.     *cw = po0;
  488.     *ch = po1;
  489.     *bw = po2;
  490.     *bh = po3;
  491. }
  492.  
  493. /* GEM:VDI set text height, returns char size and cell(box) size  */
  494.  
  495. vst_point(handle, point, cw, ch, bw, bh) int *cw, *ch, *bw, *bh; {
  496.     ct0 = 107;
  497.     ct1 = 0;
  498.     ct3 = 1;
  499.     ct6 = handle;
  500.     ii0 = point;
  501.     vdi();
  502.     *cw = po0;
  503.     *ch = po1;
  504.     *bw = po2;
  505.     *bh = po3;
  506. }
  507.  
  508. /* GEM:VDI set text baseline rotation */
  509.  
  510. vst_rotation(handle, angle) { return vset(handle, 13, angle); }
  511.  
  512. /* GEM:VDI set text face */
  513.  
  514. vst_font(handle, font) { return vset(handle, 21, font); }
  515.  
  516. /* GEM:VDI set color of the text */
  517.  
  518. vst_color(handle, color) { return vset(handle, 22, color); }
  519.  
  520. /* 
  521.  * GEM:VDI set effects of the text 
  522.  *    bit 0    bold
  523.  *    bit 1    light
  524.  *    bit 2    italic
  525.  *    bit 3    underline
  526.  *    bit 4    outline
  527.  *    bit 5    shadowed
  528.  */
  529.  
  530.  
  531. vst_effects(handle, effect) { return vset(handle, 106, effect); }
  532.  
  533. /* GEM:VDI set text alignment  */
  534.  
  535. vst_alignment(handle, hor, ver, nhor, nver) int *nhor, *nver; {
  536.     ct0 = 39;
  537.     ct1 = 0;
  538.     ct3 = 2;
  539.     ct6 = handle;
  540.     ii0 = hor;
  541.     ii0 = ver;
  542.     vdi();
  543.     *nhor = io0;
  544.     *nver = io1;
  545. }
  546.  
  547. /* GEM:VDI set fill interior */
  548.  
  549. vsf_interior(handle, style) { return vset(handle, 23, style); }
  550.  
  551. /* GEM:VDI set fill style index  */
  552.  
  553. vsf_style(handle, style) { return vset(handle, 24, style); }
  554.  
  555. /* GEM:VDI set fill color index */
  556.  
  557. vsf_color(handle, color) { return vset(handle, 25, color); }
  558.  
  559. /* GEM:VDI set perimeter visibility */
  560.  
  561. vsf_perimeter(handle, visible) { return vset(handle, 105, visible); }
  562.  
  563. /* GEM:VDI set user defined fill pattern */
  564.  
  565. vsf_updat(handle, pat, count) int *pat; {
  566.     ct0 = 112;
  567.     ct1 = 0;
  568.     ct3 = count * 16;
  569.     ct6 = handle;
  570.     vdi1 = pat;
  571.     vdi();
  572.     vdi1 = &ii0;
  573. }
  574.  
  575. /* GEM:VDI set an attribute */
  576.  
  577. vset(handle, op, arg) {
  578.     ct0 = op;
  579.     ct1 = 0;
  580.     ct3 = 1;
  581.     ct6 = handle;
  582.     ii0 = arg;
  583.     vdi();
  584.     return io0;
  585. }
  586.  
  587. /* GEM:VDI copy raster opaque */
  588.  
  589. vro_cpyfm( handle, wr_mode, pxy, srcmfdb, desmfdb) 
  590.     int *pxy, *srcmfdb, *desmfdb; {
  591.     ct0 = 109;
  592.     ct1 = 4;
  593.     ct3 = 1;
  594.     ct6 = handle;
  595.     ct7 = srcmfdb;
  596.     ct9 = desmfdb;
  597.     ii0 = wr_mode;
  598.     vdi2 = pxy;
  599.     vdi();
  600.     vdi2 = &pi0;
  601. }
  602.  
  603. /* GEM:VDI copy raster transparent */
  604.  
  605. vrt_cpyfm(handle,wr_mode,pxy,srcmfdb,desmfdb,color_index) 
  606.     int *pxy, *srcmfdb, *desmfdb, *color_index; {
  607.     ct0 = 121;
  608.     ct1 = 4;
  609.     ct3 = 3;
  610.     ct6 = handle;
  611.     ii0 = wr_mode;
  612.     vdi2 = pxy;
  613.     ii1 = color_index[0];
  614.     ii2 = color_index[1];
  615.     ct7 = srcmfdb;
  616.     ct9 = desmfdb;
  617.     vdi();
  618.     vdi2 = &pi0;
  619. }
  620.  
  621. /* GEM:VDI transform form */
  622.  
  623. vr_trnfm(handle, srcmfdb, desmfdb) int *srcmfdb, *desmfdb; {
  624.     ct0 = 110;
  625.     ct1 = ct3 = 0;
  626.     ct6 = handle;
  627.     ct7 = srcmfdb;
  628.     ct9 = desmfdb;
  629.     vdi();
  630. }
  631.  
  632. /* GEM:VDI get pixel */
  633.  
  634. v_get_pixel(handle, x, y, pel, index) int *pel, *index; {
  635.     ct0 = 105;
  636.     ct1 = 1;
  637.     ct2 = 0;
  638.     ct6 = handle;
  639.     pi0 = x;
  640.     pi1 = y;
  641.     vdi();
  642.     *pel = io0;
  643.     *index = io1;
  644. }
  645.  
  646. /* GEM:VDI set input mode */
  647.  
  648. vsin_mode(handle, dev_type, mode) {
  649.     ct0 = 33;
  650.     ct1 = 0;
  651.     ct3 = 2;
  652.     ct6 = handle;
  653.     ii0 = dev_type;
  654.     ii1 = mode;
  655.     vdi();
  656. }
  657.  
  658. /* GEM:VDI input locator, request mode */
  659.  
  660. vrq_locator( handle, x, y, xout, yout, term) int *xout, *yout, *term; {
  661.     ct0 = 28;
  662.     ct1 = 1;
  663.     ct3 = 0;
  664.     ct6 = handle;
  665.     pi0 = x;
  666.     pi1 = y;
  667.     vdi();
  668.     *xout = po0;
  669.     *yout = po1;
  670.     *term = io0;
  671. }
  672.  
  673. /* GEM:VDI input locator, sample mode */
  674.  
  675. vsm_locator(handle, x, y, xout, yout, term) int *xout, *yout, *term; {
  676.     ct0 = 28;
  677.     ct1 = 1;
  678.     ct3 = 0;
  679.     ct6 = handle;
  680.     pi0 = x;
  681.     pi1 = y;
  682.     vdi();
  683.     *xout = po0;
  684.     *yout = po1;
  685.     *term = io0;
  686.     return (ct2 | (ct4 << 1));
  687. }
  688.  
  689. /* GEM:VDI input valuator, request mode */
  690.  
  691. vrq_valuator(handle, valuator_in, valuator_out, terminator)
  692.     int *valuator_out, *terminator; {
  693.     ct0 = 29;
  694.     ct1 = 0;
  695.     ct3 = 1;
  696.     ct6 = handle;
  697.     ii0 = valuator_in;
  698.     vdi();
  699.     *valuator_out = io0;
  700.     *terminator - io1;
  701. }
  702.  
  703. /* GEM:VDI input valuator, sample mode */
  704.  
  705. vsm_valuator(handle, valuator_in, valuator_out, terminator, status)
  706.     int *valuator_out, *terminator, *status; {
  707.     ct0 = 29;
  708.     ct1 = 0;
  709.     ct3 = 1;
  710.     ct6 = handle;
  711.     ii0 = valuator_in;
  712.     vdi();
  713.     *valuator_out = io0;
  714.     *terminator - io1;
  715.     *status = ct4;
  716. }
  717.  
  718. /* GEM:VDI input choice, request mode */
  719.  
  720. vrq_choice(handle, ch_in, ch_out) int *ch_out; {
  721.     ct0 = 30;
  722.     ct1 = 0;
  723.     ct3 = 1;
  724.     ct6 = handle;
  725.     ii0 = ch_in;
  726.     vdi();
  727.     *ch_out = io0;
  728. }
  729.  
  730. /* GEM:VDI input choice, request mode */
  731.  
  732. vsm_choice(handle, choice) int *choice; {
  733.     ct0 = 30;
  734.     ct1 = 0;
  735.     ct3 = 0;
  736.     ct6 = handle;
  737.     vdi();
  738.     *choice = io0;
  739.     return ct4;
  740. }
  741.  
  742. /* GEM:VDI input string, request mode */
  743.  
  744. vrq_string(handle, max_length, echo_mode, echo_xy, string) 
  745.     int *echo_xy; char *string; {
  746.     char *temp;
  747.     ct0 = 31;
  748.     ct1 = 1;
  749.     ct3 = 2;
  750.     ct6 = handle;
  751.     ii0 = max_length;
  752.     ii1 = echo_mode;
  753.     pi0 = echo_xy[0];
  754.     pi1 = echo_xy[1];
  755.     vdi();
  756.     temp = &io0;
  757.     while (*string++ = *temp++)
  758.       ;
  759. }
  760.  
  761. /* GEM:VDI input string, sample mode */
  762.  
  763. vsm_string(handle, max_length, echo_mode, echo_xy, string) 
  764.     int *echo_xy; char *string; {
  765.     char *temp;
  766.     ct0 = 31;
  767.     ct1 = 1;
  768.     ct3 = 2;
  769.     ct6 = handle;
  770.     ii0 = max_length;
  771.     ii1 = echo_mode;
  772.     pi0 = echo_xy[0];
  773.     pi1 = echo_xy[1];
  774.     vdi();
  775.     temp = &io0;
  776.     while (*string++ = *temp++)
  777.       ;
  778.     return ct4;
  779. }
  780.  
  781. /* GEM:VDI set mouse form */
  782.  
  783. vsc_form(handle, pcur_form) int *pcur_form; {
  784.     ct0 = 111;
  785.     ct1 = 0;
  786.     ct3 = 37;
  787.     ct6 = handle;
  788.     vdi1 = pcur_form;
  789.     vdi();
  790.     vdi1 = &ii0;
  791. }
  792.  
  793. /* GEM:VDI exchange timer interrupt vector */
  794.  
  795. vex_timv(handle, tim_addr, otim_addr, tim_conv) 
  796.     int *tim_addr, *otim_addr, *tim_conv; {
  797.     ct0 = 118;
  798.     ct1 = 0;
  799.     ct3 = 0;
  800.     ct6 = handle;
  801.     ct7 = tim_addr;
  802.     vdi();
  803.     *otim_addr++ = ct9;
  804.     *otim_addr = ct10;
  805.     *tim_conv = io0;
  806. }
  807.  
  808. /* GEM:VDI show cursor */
  809.  
  810. v_show_cur(handle, reset) {
  811.     ct0 = 122;
  812.     ct1 = 1;
  813.     ct6 = handle;
  814.     ii0 = reset;
  815.     vdi();
  816. }
  817.  
  818. /* GEM:VDI hide cursor */
  819.  
  820. v_hide_c( handle ) {
  821.     ct0 = 123;
  822.     ct1 = ct3 = 0;
  823.     ct6 = handle;
  824.     vdi();
  825. }
  826.  
  827. /* GEM:VDI sample mouse button state */
  828.  
  829. vq_mouse(handle, pstatus, x, y) int *pstatus, *x, *y; {
  830.     ct0 = 124;
  831.     ct1 = ct3 = 0;
  832.     ct6 = handle;
  833.     vdi();
  834.     *pstatus = io0;
  835.     *x = po0;
  836.     *y = po1;
  837. }
  838.  
  839. /* GEM:VDI exchange button change vector */
  840.  
  841. vex_butv(handle, pusrcode, psavcode) int *pusrcode, *psavcode; {
  842.     ct0 = 125;
  843.     ct1 = ct3 = 0;
  844.     ct6 = handle;
  845.     ct7 = pusrcode;
  846.     vdi();
  847.     *psavcode++ = ct9;
  848.     *psavcode = ct10;
  849. }
  850.  
  851. /* GEM:VDI exchange mouse movemnt vector */
  852.  
  853. vex_motv(handle, pusrcode, psavcode) int *pusrcode, *psavcode; {
  854.     ct0 = 126;
  855.     ct1 = ct3 = 0;
  856.     ct6 = handle;
  857.     ct7 = pusrcode;
  858.     vdi();
  859.     *psavcode++ = ct9;
  860.     *psavcode = ct10;
  861. }
  862.  
  863. /* GEM:VDI exchange cursor change vector */
  864.  
  865. vex_curv(handle, pusrcode, psavcode) int *pusrcode, *psavcode; {
  866.     ct0 = 127;
  867.     ct1 = ct3 = 0;
  868.     ct6 = handle;
  869.     ct7 = pusrcode;
  870.     vdi();
  871.     *psavcode++ = ct9;
  872.     *psavcode++ = ct10;
  873. }
  874.  
  875. /* GEM:VDI sample keyboard state information */
  876.  
  877. vq_key_s(handle, pstatus) int *pstatus; {
  878.     ct0 = 128;
  879.     ct1 = ct3 = 0;
  880.     ct6 = handle;
  881.     vdi();
  882.     *pstatus = io0;
  883. }
  884.  
  885. /* GEM:VDI inqure color representation */
  886.  
  887. vq_color(handle, color_index, set_flag, rgb) int *rgb; {
  888.     ct0 = 26;
  889.     ct1 = 0;
  890.     ct3 = 2;
  891.     ct6 = handle;
  892.     ii0 = color_index;
  893.     ii1 = set_flag;
  894.     vdi3 = rgb;
  895.     vdi();
  896.     vdi3 = &io0;
  897. }
  898.  
  899. /* GEM:VDI inquire current polyline attrtibutes */
  900. vql_attributes(handle, attrib) int *attrib; {
  901.     ct0 = 35;
  902.     ct1 = ct3 = 0;
  903.     ct6 = handle;
  904.     vdi3 = attrib;
  905.     vdi();
  906.     vdi3 = &io0;
  907.     attrib[3] = po0;
  908. }
  909.  
  910. /* GEM:VDI inquire current polymaarker attributes */
  911.  
  912. vqm_attributes(handle, attrib) int *attrib; {
  913.     ct0 = 36;
  914.     ct1 = ct3 = 0;
  915.     ct6 = handle;
  916.     vdi3 = attrib;
  917.     vdi();
  918.     vdi3 = &io0;
  919.     attrib[3] = po1;
  920. }
  921.  
  922. /* GEM:VDI inquire current fill area attributes */
  923.  
  924. vqf_attributes(handle, attrib) int *attrib; {
  925.     ct0 = 37;
  926.     ct1 = ct3 = 0;
  927.     ct6 = handle;
  928.     vdi3 = attrib;
  929.     vdi();
  930.     vdi3 = &io0;
  931. }
  932.  
  933. /* GEM:VDI inquire current graphic text attributes */
  934.  
  935. vqt_attributes(handle, attrib) int *attrib; {
  936.     ct0 = 38;
  937.     ct1 = ct3 = 0;
  938.     ct6 = handle;
  939.     vdi3 = attrib;
  940.     vdi4 = &attrib[6];
  941.     vdi();
  942.     vdi3 = &io0;
  943.     vdi4 = &po0;
  944. }
  945.  
  946. /* GEM:VDI inquire text extent */
  947.  
  948. vqt_extent(handle, string, extent) int *extent; char *string; {
  949.     char *temp;
  950.     ct0 = 116;
  951.     ct1 = 0;
  952.     ct6 = handle;
  953.     vdi4 = extent;
  954.     temp = &ii0;
  955.     for (ct3 = 0;*temp++ = *string++;ct3++)
  956.        ;
  957.     vdi();
  958.     vdi4 = &po0;
  959. }
  960.  
  961. /* GEM:VDI inquire character cell width */
  962.  
  963. vqt_width(handle,charac,cwid,ldelt,rdelt) int *cwid, *ldelt, *rdelt; {
  964.     ct0 = 117;
  965.     ct1 = 0;
  966.     ct3 = 1;
  967.     ct6 = handle;
  968.     ii0 = charac;
  969.     vdi();
  970.     *cwid = po0;
  971.     *ldelt = po2;
  972.     *rdelt = pox[0];
  973.     return io0;
  974. }
  975.  
  976. /* GEM:VDI inquire face name and index */
  977.  
  978. vqt_name(handle, enum, name) char *name; {
  979.     ct0 = 130;
  980.     ct1 = 0;
  981.     ct3 = 1;
  982.     ct6 = handle;
  983.     ii0 = enum;
  984.     vdi3 = name;
  985.     vdi();
  986.     vdi3 = &io0;
  987.     return io0;
  988. }
  989.  
  990. /* GEM:VDI inquire cell array */
  991.  
  992. vq_cellarray( handle, pxy, rowlen, nrows, elused, rowsused, status, carray )
  993.         int *pxy, *elused, *rowsused, *status, *carray; {
  994.     int i;
  995.     ct0 = 27;
  996.     ct1 = 2;
  997.     ct3 = 0;
  998.     ct6 = handle;
  999.     vdi2 = pxy;
  1000.     vdi3 = carray;
  1001.     ct7 = rowlen;
  1002.     ct8 = nrows;
  1003.     vdi();
  1004.     vdi2 = &pi0;
  1005.     vdi3 = &io0;
  1006.     *elused = ct9;
  1007.     *rowsused = ct10;
  1008.     *status = ct11;
  1009. }
  1010.  
  1011. /* GEM:VDI inquire input mode */
  1012.  
  1013. vqin_mode(handle, devtype, inpmode) int *inpmode; {
  1014.     ct0 = 115;
  1015.     ct1 = 0;
  1016.     ct3 = 1;
  1017.     ct6 = handle;
  1018.     ii0 = devtype;
  1019.     vdi();
  1020.     *inpmode = io0;
  1021. }
  1022.  
  1023. /* GEM:VDI inquire current face information */
  1024.  
  1025. vqt_fontinfo(handle, minade, maxade, dist, maxwid, effects)
  1026.         int *minade, *maxade, *dist, *maxwid, *effects; {
  1027.     ct0 = 131;
  1028.     ct1 = ct3 = 0;
  1029.     ct6 = handle;
  1030.     vdi();
  1031.     *minade = io0;
  1032.     *maxade = io1;
  1033.     dist[0] = po1;
  1034.     dist[1] = po3;
  1035.     dist[2] = pox[1];
  1036.     dist[3] = pox[3];
  1037.     dist[3] = pox[5];
  1038.     *maxwid = po0;
  1039.     effects[0] = po2;
  1040.     effects[1] = pox[0];
  1041.     effects[2] = pox[2];
  1042. }
  1043.  
  1044. /* GEM:VDI inquire addressable alpha character cells */
  1045.  
  1046. vq_chchells(handle, rows, columns) int *rows, *columns; {
  1047.     vesc(handle, 1);
  1048.     *rows = io0;
  1049.     *columns = io1;
  1050. }
  1051.  
  1052. /* GEM:VDI exit alpha mode */
  1053.  
  1054. v_exit_cur(handle)  { 
  1055.     vesc(handle, 2);
  1056. }
  1057.  
  1058. /* GEM:VDI enter alpha mode */
  1059.  
  1060. v_enter_cur(handle) { 
  1061.     vesc(handle, 3);
  1062. }
  1063.  
  1064. /* GEM:VDI alpha cursor up */
  1065.  
  1066. v_curup(handle) {
  1067.     vesc(handle, 4);
  1068. }
  1069.  
  1070. /* GEM:VDI alpha cursor down */
  1071.  
  1072. v_curdown(handle) {
  1073.     vesc(handle, 5);
  1074. }
  1075.  
  1076. /* GEM:VDI alpha cursor right */
  1077.  
  1078. v_curright(handle) {
  1079.     vesc(handle, 6);
  1080. }
  1081.  
  1082. /* GEM:VDI alpha cursor left */
  1083.  
  1084. v_curleft(handle) {
  1085.     vesc(handle, 7);
  1086. }
  1087.  
  1088. /* GEM:VDI alpha cursor home */
  1089.  
  1090. v_curhome(handle) {
  1091.     vesc(handle, 8);
  1092. }
  1093.  
  1094. /* GEM:VDI erase to end of alpha screen */
  1095.  
  1096. v_eeos(handle) {
  1097.     vesc(handle, 9);
  1098. }
  1099.  
  1100. /* GEM:VDI erase to end of alpha text line */
  1101.  
  1102. v_eeol(handle) {
  1103.     vesc(handle, 10);
  1104. }
  1105.  
  1106. /* GEM:VDI direct alpha cursor address */
  1107.  
  1108. v_curaddress(handle, row, column) {
  1109.     ii0 = row;
  1110.     ii1 = column;
  1111.     ct0 = 5;
  1112.     ct1 = 0;
  1113.     ct3 = 2;
  1114.     ct5 = 11;
  1115.     ct6 = handle;
  1116.     vdi();
  1117. }
  1118.  
  1119. /* GEM:VDI output cursor addressable alpha text */
  1120.  
  1121. v_curtext(handle, string) char *string; {
  1122.     int *temp;
  1123.     temp = &ii0;
  1124.     while (*temp++ = *string++)
  1125.        ;    
  1126.     vesc(handle, 12);
  1127. }
  1128.  
  1129. /* GEM:VDI reverse video on */
  1130.  
  1131. v_rvon(handle) {
  1132.     vesc(handle, 13);
  1133. }
  1134.  
  1135. /* GEM:VDI reverse video off */
  1136.  
  1137. v_rvoff(handle) {
  1138.     vesc(handle, 14);
  1139. }
  1140.  
  1141. /* GEM:VDI inquire current alpha cursor address */
  1142.  
  1143. vq_curaddress(handle, row, column) int *row, *column; {
  1144.     vesc(handle, 15);
  1145.     *row = io0;
  1146.     *column = io1;
  1147. }
  1148.  
  1149. /* GEM:VDI inquire tablet status */
  1150.  
  1151. vq_tabstatus(handle) {
  1152.     vesc(handle, 16);
  1153.     return io0;
  1154. }
  1155.  
  1156. /* GEM:VDI hard copy */
  1157.  
  1158. v_hardcopy(handle) {
  1159.     vesc(handle, 17);
  1160. }
  1161.  
  1162. /* GEM:VDI place graphic cursor at location */
  1163.  
  1164. v_dspcur(handle, x, y) {
  1165.     pi0 = x;
  1166.     pi1 = y;
  1167.     ct0 = 5;
  1168.     ct1 = 1;
  1169.     ct3 = 0;
  1170.     ct5 = 18;
  1171.     ct6 = handle;
  1172.     vdi();
  1173. }
  1174.  
  1175. /* GEM:VDI remove last graphic cursor */
  1176.  
  1177. v_rmcur(handle) {
  1178.     vesc(handle, 19);
  1179. }
  1180.  
  1181. /* GEM:VDI form advance */
  1182.  
  1183. v_form_adv(handle) {
  1184.     vesc(handle, 20);
  1185. }
  1186.  
  1187. /* GEM:VDI output window */
  1188.  
  1189. v_output_window(handle, xyarray) int *xyarray; {
  1190.     ct0 = 5;
  1191.     ct1 = 2;
  1192.     ct3 = 0;
  1193.     ct5 = 21;
  1194.     ct6 = handle;
  1195.     vdi2 = xyarray;
  1196.     vdi();
  1197.     vdi2 = &pi0;
  1198. }
  1199.     
  1200. /* GEM:VDI clear display list */
  1201.  
  1202. v_clear_disp_list(handle) {
  1203.     vesc(handle, 22);
  1204. }
  1205.  
  1206. /* GEM:VDI output bit image file */
  1207.  
  1208. v_bit_image(handle, filename, aspect, scaling, npts, xyarray) 
  1209.         char *filename; int *xyarray; {
  1210.     int *temp;
  1211.     ct0 = 5;
  1212.     ct1 = npts;
  1213.     ii0 = aspect;
  1214.     ii1 = scaling;
  1215.     temp = &ii2;
  1216.     for (ct3 = 2;*temp++ = *filename;ct3++)
  1217.       ;
  1218.     ct5 = 23;
  1219.     ct6 = handle;
  1220.     vdi2 = xyarray;
  1221.     vdi();
  1222.     vdi2 = &pi0;
  1223. }
  1224.  
  1225. /* GEM:VDI select palette */
  1226.  
  1227. vs_palette(handle, palette) {
  1228.     ct0 = 5;
  1229.     ct1 = 0;
  1230.     ct3 = 1;
  1231.     ct5 = 60;
  1232.     ct6 = handle;
  1233.     ii0 = palette;
  1234.     vdi();
  1235.     return io0;
  1236. }
  1237.  
  1238. /* GEM:VDI inquire palette film types */
  1239.  
  1240. vqp_flims(handle,fmnames) char *fmnames; {
  1241.     int *temp,i;
  1242.     vesc(handle, 91);
  1243.     temp = &io0;
  1244.     for (i=0;i<125;i++)
  1245.       *fmnames++ = *temp++;
  1246. }
  1247.     
  1248. /* GEM:VDI inquire palette driver state */
  1249.  
  1250. vqp_state(handle, port, fmname, lness, ilace, planes, indexes) 
  1251.         int *port, *fmname, *lness, *ilace, *planes, *indexes; {
  1252.     int *temp,i;
  1253.     vesc(handle, 22);
  1254.     *port = io0;
  1255.     *fmname = io1;
  1256.     *lness = io2;
  1257.     *ilace = io3;
  1258.     *planes = io4;
  1259.     temp = &io5;
  1260.     for (i=5;i<21;i++)
  1261.       *indexes++ = *temp++;
  1262. }
  1263.  
  1264. /* GEM:VDI escape function caller */
  1265.  
  1266. vsp_state(handle, port,fmnum, lness, ilace, planes, indexes)
  1267.         int *indexes; {
  1268.     int *temp,i;
  1269.  
  1270.     ct0 = 5;
  1271.     ct1 = 0;
  1272.     ct3 = 20;
  1273.     ct5 = 93;
  1274.     ct6 = handle;
  1275.     ii0 = port;
  1276.     ii1 = fmnum;
  1277.     ii2 = lness;
  1278.     ii3 = ilace;
  1279.     ii4 = planes;
  1280.     temp = &ii5;
  1281.     for (i=5;i<21;i++)
  1282.       *temp++ = *indexes++;
  1283.     vdi();
  1284. }
  1285.  
  1286. /* GEM:VDI save palette driver state */
  1287.  
  1288. vsp_save(handle) {
  1289.     vesc(handle, 94);
  1290. }
  1291.  
  1292. /* GEM:VDI supress palette messages */
  1293.  
  1294. vsp_message(handle) {
  1295.     vesc(handle, 95);
  1296. }
  1297.  
  1298. /* GEM:VDI palette error inquire */
  1299.  
  1300. vqp_error(handle) {
  1301.     vesc(handle, 96);
  1302.     return io0;
  1303. }
  1304.  
  1305. /* GEM:VDI update metafile extents */
  1306.  
  1307. v_meta_extents(handle, minx, miny, maxx, maxy) {
  1308.     ct0 = 5;
  1309.     ct1 = 2;
  1310.     ct3 = 0;
  1311.     ct5 = 98;
  1312.     ct6 = handle;
  1313.     pi0 = minx;
  1314.     pi1 = miny;
  1315.     pi2 = maxx;
  1316.     pi3 = maxy;
  1317.     vdi();
  1318. }
  1319.  
  1320. /* GEM:VDI write metafile item */
  1321.  
  1322. v_write_meta(handle,numii,ii,numpi,pi) {
  1323.     ct0 = 5;
  1324.     ct1 = numpi;
  1325.     ct3 = numii;
  1326.     ct6 = handle;
  1327.     vdi2 = pi;
  1328.     vdi1 = ii;
  1329.     vdi();
  1330.     vdi2 = &pi0;
  1331.     vdi1 = &ii0;
  1332. }
  1333.  
  1334. /* GEM:VDI change gem vdi filename */
  1335.  
  1336. vm_filename(handle, filename) char *filename; {
  1337.     int *temp;
  1338.     ct0 = 5;
  1339.     ct1 = 0;
  1340.     temp = &ii0;
  1341.     for (ct3=1;*temp++ = *filename++;ct3++)
  1342.       ;
  1343.     ct5 = 100;
  1344.     ct6 = handle;
  1345.     vdi();
  1346. }
  1347.  
  1348. /* GEM:VDI escape function caller */
  1349.  
  1350. vesc(handle, funcid) {
  1351.     ct0 = 5;
  1352.     ct1 = ct3 = 0;
  1353.     ct5 = funcid;
  1354.     ct6 = handle;
  1355.     vdi();
  1356. }
  1357.  
  1358. vdi() {
  1359.     /* 
  1360.          * load address of vdi parameter block into a0
  1361.          * transfer a0 to d1
  1362.          * load 115 into d0
  1363.          * trap #2
  1364.          */
  1365.     asm( lag vdi0 0   tad 0 1   ldw 115 0   trp 2 );
  1366. }
  1367.